﻿#ifndef UDPCLIENT_H
#define UDPCLIENT_H

#include <QObject>
#include <QUdpSocket>
#include <QHostAddress>

class UdpClient : public QObject {
    Q_OBJECT

public:
    explicit UdpClient(const QHostAddress &serverAddress, quint16 serverPort, QObject *parent = nullptr);
    ~UdpClient();

    bool sendData(const QByteArray &data);

signals:
//    void sendDataResult(bool success);

private slots:
    void readPendingDatagrams();

private:
    QHostAddress m_serverAddress;
    quint16 m_serverPort;
    QUdpSocket *udpSocket;
};

#endif // UDPCLIENT_H
